package cn.xxlucky.xssdk01.pojo;


import cn.xxlucky.xssdk01.pojo.shard.Delta;
import cn.xxlucky.xssdk01.pojo.shard.Message;
import cn.xxlucky.xssdk01.pojo.shard.Usage;
import com.alibaba.fastjson.annotation.JSONField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.List;

@ApiModel("通用响应封装实体类")
public class ApiResponse {

    @ApiModelProperty(value = "错误码：0表示成功，非0表示错误", example = "0")
    @JSONField(name = "code")
    private Integer code;

    @ApiModelProperty(value = "错误码的描述信息", example = "Success")
    @JSONField(name = "message")
    private String message;

    @ApiModelProperty(value = "本次请求的唯一id", example = "cha000b0003@dx1905cd86d6bb86d552")
    @JSONField(name = "sid")
    private String sid;

    @ApiModelProperty(value = "大模型结果的数组")
    @JSONField(name = "choices")
    private List<Choice> choices;

    @ApiModelProperty(value = "本次请求消耗的token数量")
    @JSONField(name = "usage")
    private Usage usage;

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getSid() {
        return sid;
    }

    public void setSid(String sid) {
        this.sid = sid;
    }

    public List<Choice> getChoices() {
        return choices;
    }

    public void setChoices(List<Choice> choices) {
        this.choices = choices;
    }

    public Usage getUsage() {
        return usage;
    }

    public void setUsage(Usage usage) {
        this.usage = usage;
    }

    @ApiModel("大模型结果实体类")
    public static class Choice {

        @ApiModelProperty(value = "大模型结果序号，在多候选中使用", example = "0")
        @JSONField(name = "index")
        private Integer index;

        @ApiModelProperty(value = "大模型结果的消息内容")
        @JSONField(name = "message")
        private Message message;

        @ApiModelProperty(value = "大模型增量结果")
        @JSONField(name = "delta")
        private Delta delta;

        public Integer getIndex() {
            return index;
        }

        public void setIndex(Integer index) {
            this.index = index;
        }

        public Message getMessage() {
            return message;
        }

        public void setMessage(Message message) {
            this.message = message;
        }

        public Delta getDelta() {
            return delta;
        }

        public void setDelta(Delta delta) {
            this.delta = delta;
        }
    }
}
